

************************************
*Group Inercept
*Table 2
************************************

************************************
*Numeric Export disabled
local TEX ""
local TEXON 0 //Change "0" to "1" to enable exporting numeric results to .txt files
if !`TEXON' local TEX "*"
************************************

***********************************
*Make sure working direcotry is set
***********************************

*Load Gilens' data, recode variables
do "Enns_SociologicalScience_Reproduction\LoadGilensDataRecodeConfirmAccuracy.do"


****************************
*Table 2: Group Intercept model: 90th vs 10
*Note: Columns 1 and 3 of Table 2 (Gilens Replication) in Run1st_Fig1Fig2Fig5.do
****************************
gen dif_90_10=.
recode dif_90_10 .=1 if (pred90_sw - pred10_sw)>.1
recode dif_90_10 .=0 if (pred10_sw - pred90_sw)>.1
*10th
logit policyadopted pred10_sw_lor dif_90_10 if  abs(pred90_sw - pred10_sw)>.1
*Store results as local vars
mat def results = r(table)
local coefsharedltvn = results[1,1]
local sesharedltvn = results[2,1]
local lowsharedltvn = results[5,1]
local upsharedltvn = results[6,1]
local coefsharedldiftvn = results[1,2]
local sesharedldiftvn = results[2,2]
local lowsharedldiftvn = results[5,2]
local upsharedldiftvn = results[6,2]
local conssharedltvn = results[1,3]
local lowconssharedltvn = results[5,3]
local upconssharedltvn = results[6,3]
local nsharedltvn = e(N)
*90th
logit policyadopted pred90_sw_lor dif_90_10 if  abs(pred90_sw - pred10_sw)>.1
mat def results = r(table)
local coefsharedhtvn = results[1,1]
local sesharedhtvn = results[2,1]
local lowsharedhtvn = results[5,1]
local upsharedhtvn = results[6,1]
local coefsharedhdiftvn = results[1,2]
local sesharedhdiftvn = results[2,2]
local lowsharedhdiftvn = results[5,2]
local upsharedhdiftvn = results[6,2]
local conssharedhdiftvn = results[1,3]
local lowconssharedhdiftvn = results[5,3]
local upconssharedhdiftvn = results[6,3]
local nsharedhtvn = e(N)

****************************
*Table A-2: Group Intercept model: 90th vs 50
*Note: Columns 1 and 3 (Gilens Replication) in Run1st_Fig1Fig2Fig5.do
****************************
gen dif_90_50=.
recode dif_90_50 .=1 if (pred90_sw - pred50_sw)>.1
recode dif_90_50 .=0 if (pred50_sw - pred90_sw)>.1
*50th
logit policyadopted pred50_sw_lor dif_90_50 if  abs(pred90_sw - pred50_sw)>.1
mat def results = r(table)
local pvalsharedfvn = results[4,1]
local coefsharedlfvn = results[1,1]
local sesharedlfvn = results[2,1]
local lowsharedlfvn = results[5,1]
local upsharedlfvn = results[6,1]
local coefsharedldiffvn = results[1,2]
local sesharedldiffvn = results[2,2]
local lowsharedldiffvn = results[5,2]
local upsharedldiffvn = results[6,2]
local nsharedlfvn = e(N)
local conssharedlfvn = results[1,3]
local lowconssharedlfvn = results[5,3]
local upconssharedlfvn = results[6,3]
*90th
logit policyadopted pred90_sw_lor dif_90_50 if  abs(pred90_sw - pred50_sw)>.1
mat def results = r(table)
local coefsharedhfvn = results[1,1]
local sesharedhfvn = results[2,1]
local lowsharedhfvn = results[5,1]
local upsharedhfvn = results[6,1]
local coefsharedhdiffvn = results[1,2]
local sesharedhdiffvn = results[2,2]
local lowsharedhdiffvn = results[5,2]
local upsharedhdiffvn = results[6,2]
local nsharedhfvn = e(N)
local conssharedhfvn = results[1,3]
local lowconssharedhfvn = results[5,3]
local upconssharedhfvn = results[6,3]



**********************************************************************************
**********************************************************************************
*export stored results to .txt file to insert in final manuscript (.tex file)
*Necessary packages
*ssc install `TEX'texresults2
**********************************************************************************
**********************************************************************************
*Table 2
*10 (10th vs 90)
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(coefsharedltvn) result(`coefsharedltvn') replace //coef
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(sesharedltvn) result(`sesharedltvn') append //se
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(lowsharedltvn) result(`lowsharedltvn') append //lb 
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(upsharedltvn) result(`upsharedltvn') append //ub
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(coefsharedldiftvn) result(`coefsharedldiftvn') append //coef
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(sesharedldiftvn) result(`sesharedldiftvn') append //se
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(lowsharedldiftvn) result(`lowsharedldiftvn') append //lb 
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(upsharedldiftvn) result(`upsharedldiftvn') append //ub
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(nsharedltvn) result(`nsharedltvn') round(0) append
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(conssharedltvn) result(`conssharedltvn') append //cons
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(lowconssharedltvn) result(`lowconssharedltvn') append //lb 
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(upconssharedltvn) result(`upconssharedltvn') append //ub
*90 (10th vs 90th)
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(coefsharedhtvn) result(`coefsharedhtvn') append //coef
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(sesharedhtvn) result(`sesharedhtvn') append //se
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(lowsharedhtvn) result(`lowsharedhtvn') append //lb 
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(upsharedhtvn) result(`upsharedhtvn') append //ub
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(coefsharedhdiftvn) result(`coefsharedhdiftvn') append //coef
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(sesharedhdiftvn) result(`sesharedhdiftvn') append //se
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(lowsharedhdiftvn) result(`lowsharedhdiftvn') append //lb 
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(upsharedhdiftvn) result(`upsharedhdiftvn') append //ub
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(nsharedhtvn) result(`nsharedhtvn') round(0) append
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(conssharedhdiftvn) result(`conssharedhdiftvn') append //cons
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(lowconssharedhdiftvn) result(`lowconssharedhdiftvn') append //lb 
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(upconssharedhdiftvn) result(`upconssharedhdiftvn') append //ub
*Table A-2
*50 (50th vs 90th) pvalsharedfvn
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(pvalsharedfvn) result(`pvalsharedfvn') round(3) append //pval on median
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(coefsharedlfvn) result(`coefsharedlfvn') append //coef
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(sesharedlfvn) result(`sesharedlfvn') append //se
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(lowsharedlfvn) result(`lowsharedlfvn') append //lb 
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(upsharedlfvn) result(`upsharedlfvn') append //ub
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(coefsharedldiffvn) result(`coefsharedldiffvn') append //coef
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(sesharedldiffvn) result(`sesharedldiffvn') append //se
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(lowsharedldiffvn) result(`lowsharedldiffvn') append //lb 
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(upsharedldiffvn) result(`upsharedldiffvn') append //ub
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(nsharedlfvn) result(`nsharedlfvn') round(0) append
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(conssharedlfvn) result(`conssharedlfvn') append //cons
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(lowconssharedlfvn) result(`lowconssharedlfvn') append //lb 
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(upconssharedlfvn) result(`upconssharedlfvn') append //ub
*90 (50th vs 90th)
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(coefsharedhfvn) result(`coefsharedhfvn') append //coef
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(sesharedhfvn) result(`sesharedhfvn') append //se
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(lowsharedhfvn) result(`lowsharedhfvn') append //lb 
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(upsharedhfvn) result(`upsharedhfvn') append //ub
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(coefsharedhdiffvn) result(`coefsharedhdiffvn') append //coef
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(sesharedhdiffvn) result(`sesharedhdiffvn') append //se
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(lowsharedhdiffvn) result(`lowsharedhdiffvn') append //lb 
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(upsharedhdiffvn) result(`upsharedhdiffvn') append //ub
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(nsharedhfvn) result(`nsharedhfvn') round(0) append
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(conssharedhfvn) result(`conssharedhfvn') append //cons
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(lowconssharedhfvn) result(`lowconssharedhfvn') append //lb 
`TEX'texresults2 using TxtFiles_NumericalResults\results2.txt, texmacro(upconssharedhfvn) result(`upconssharedhfvn') append //ub
**********************************************************************************
**********************************************************************************

